< previous page page_96 next page >

Page 96
Private Sub Drive1_Change()
   Call GetMappedInfo(Drive1.Drive)
End Sub
The GetErrorString function listed here uses the FormatMessage function to obtain a text description for the Err.LastDllError value retrieved when errors occur.
Results
You'll need a system connected to a network with a remote drive mapped to a local drive in order to test this example.
When the drive box selects an unmapped drive, the error message "This network connection does not exist" will be correctly displayed.
Under Windows NT, when the drive box selects a mapped drive, the error message "More data is available" will be displayed.1
Wait a minutethe code already retrieves the correct buffer length during the first call to WNetGetConnection. It looks like Windows is returning a buffer value that is not long enough to hold the lpRemoteName parameter. This contradicts the documentation shown above for the lpnLength parameter.
Is it a Windows bug? If not, why? If so, how would you work around it?
7017a6ead0e3c4111b47a554df321e9f.gif 7017a6ead0e3c4111b47a554df321e9f.gif
1 Under Windows 95/98, this puzzle works correctly. If you are not using Windows NT, I encourage you to read the puzzle and go directly to the solution, while repeating over and over in your mind, "I will test all my software on Windows NT, I will test all my software on Windows NT. . . ."

 
< previous page page_96 next page >